Repository navigation
fix(app-shell): the record page shows a save's new values as soon as the save succeeds - #33983
Merged
Merged
Conversation
…'s toast The page laid only its re-read over the record it shows, so after a save the old values stayed on screen next to the success toast until that read answered. Take the record the write's MutationEvent carries instead, and let the re-read replace it as before. Claude-Session: https://claude.ai/code/session_01ADHkmNxp4Cc7UZwqZmMUei Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNxp4Cc7UZwqZmMUei Co-authored-by: Claude <noreply@anthropic.com>
…-7u49a5 Claude-Session: https://claude.ai/code/session_01ADHkmNxp4Cc7UZwqZmMUei Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 席位核对Verdict: ACCEPT · head
|
Contributor
Author
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 落地Landing approved by the maintainer in the seat thread at 2026-11-15T16:10Z ("批准席位 本班复核通过的 PR 执行 --land"). This stroke:
State change: on MERGED, |
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #33827
Clause-②: no
Metadata-protocol: none
维护者速读
findOne重新读取的结果,而这次读取和保存后的另外五六个请求一起排队,staging 上要几秒,于是「已更新」提示出来时字段还是旧值。@object-ui/app-shell的记录页视图和一个新的小函数,无 spec、无服务端改动,不多发请求。保存没改的关联字段保留已展开的名字;保存改了的关联字段先显示新 id,重新读取回来后显示名字。回滚 = revert。recordSaveEcho.ts的applySavedRecordEcho(哪些键可以被返回值覆盖);RecordDetailView.tsx记录读取 effect 之后新增的onMutation订阅;测试RecordDetailView.timelineCount-28737.test.tsx末尾的 objectstack#33827 describe。pnpm --dir ui exec vitest run packages/app-shell/src/views/RecordDetailView.timelineCount-28737.test.tsx,预期 12/12 通过;在 app-crm 打开一个客户,编辑 → 改网站 → 更新,提示出现的同时页头「网站」已是新值。What changes
RecordDetailViewsubscribes to the adapter'sonMutationfor anupdateof the record it shows and lays the event'srecord(the server's answer to the write, field-masked like any read) over the record it holds, through the newapplySavedRecordEcho. The adapter emits that event before the write's promise resolves, in the same dispatch that invalidates the record on the bus, so the page holds the saved record by the time the edit dialog'sonSuccessshows the success toast.recordInvalidationNonceand replaces the record whole when its$expandread answers; objectstack#30082's stream re-read (objectstack#30035) is untouched.applySavedRecordEcho): only an answer naming this record (idor_id) is taken; nothing is laid over a record that has not loaded; a key the answer leaves out keeps the held value; a relation held EXPANDED that the answer gives back as the same bare id keeps the expanded value, so an untouched lookup never flips from its name to its id; a relation the save changed takes the answer's value; an answer that changes nothing hands back the held object itself (ui/AGENTS.md chore: version packages #10).Why
Measured on
examples/app-crm(fresh stack, Console fromui/apps/consolevia Vite so it serves this branch's src, Playwright, the edit dialog on acrm_accountrecord page):PATCH /api/v1/data/crm_account/IDanswer already carries the full saved record ({ object, id, record: { … website: NEW_VALUE … } }).pageRecord, which only the record-load effect's re-read (GET /api/v1/data/crm_account?populate=…&filter=["id","=",ID]) replaces. That read goes out on the invalidation together with/page,field-access,sys_audit_log, approvals and twosecurity/explainasks.populateread delayed ⇒ the saved value at 2822 ms after the click;/page,field-accessor the plainGET …/IDdelayed ⇒ 1119–1273 ms. So the stale window is that read's latency, which on the staging free tier is seconds.Tests
New top-level
describein the shared real-adapter harnessRecordDetailView.timelineCount-28737.test.tsx(StrictMode, held transport, the console's mutation bridge mounted beside the view), plus a unit file for the merge rule:the record page: the saved value is drawn when the save resolves, with every re-read still heldandthe drawer: …: open, settle,ds.update(OBJECT, 'c1', { name: 'Renamed' }), release ONLY the PATCH and await the update's promise (the moment the dialog's success toast fires); the re-reads it triggered are asserted present and all still unanswered, andRenamedis on screen.a save to another record of the object leaves this one as it is.recordSaveEcho.test.ts(7 cases): saved values taken and omitted keys kept; an expanded relation kept for the same id (single and multi); a changed relation taken; identity kept for an equal answer; an answer naming another record, no id,undefinedor an array taken as nothing;_id; nothing laid over an unloaded record.id: 'c1'for every write; it now echoes the id the PATCH path names, so thec2case answers as the server would.Runs, ablation and the wider suite (head 63f0286)
Test Files 2 passed (2),Tests 19 passed (19)(the 9 existing objectstack#28737 / Console: a packaged app's record page no longer shows a record's field-change history (Changes chip), since the record route reads only its package scope (#29846) #29878 / Record 动态 stays stale after a save: the toast says updated and the feed still shows the old count until a reload #30035 cases plus the 3 above, and the 7 unit cases).scripts/ablation-replace.mjs(anchorsetPageRecord((held: unknown) => applySavedRecordEcho(…))hit 1 → 0, replaced withvoid applySavedRecordEcho;; restored blob equal to HEAD,git diff HEADempty): both save pins red,AssertionError: expected 'ContactContact c1Contact c1ContactEdi…' to contain 'Renamed',Tests 2 failed | 10 passed (12); the objectstack#30035 pins stay green in the ablated run. ui vitest resolves@object-ui/*tosrc/, so no build sits between mutation and run.ui/packages/app-shell/srcandui/apps/console/srcthat namesRecordDetailView,recordPagePayloadorrecordSaveEcho(242 files, selected bygrep -rlE):Test Files 242 passed (242),Tests 1961 passed (1961)(lock VERDICT command-exit 0). Run at 92ea4dd; 63f0286 only drops an explicitanyon the new setter line, and the two pin files were re-run on 63f0286. The rest of Test UI is CI's.pnpm --filter @object-ui/app-shell run type-check(tsc --noEmitandtsc -p tsconfig.test.json) afterturbo run build --filter='@object-ui/app-shell^...': VERDICT command-exit 0.pnpm exec eslinton the four touched files fromui/: 0 errors (pre-existing warnings only; none on the added lines).pnpm run check:new-line-citations(ui):0 new citation(s).Acceptance notes
examples/app-crm(objectstack dev --fresh, Console via Vite on this branch's src, admin,crm_account「Initech」, edit dialog → Website → Update; times from the click; every post-save read held 2 s by Playwright routing unless said):?recordId=over the list): the link is on the page when the toast shows (counted at the toast, 1 of 1).RecordDetailView.tsx, the harness test, the newrecordSaveEcho.tspair and the changeset.Verification
Gates from
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon 63f0286 (change set: 5 paths vs merge base 895783a): 38 derived, 38 run, all exit 0;dispatch-gates --ran: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero …)". Among themcheck:type-check-debt,check:type-check-coverage,check:cross-package-test-inputs,check:test-source-alias,check:published-files,check:nul-bytes,check-sdui-manifest(and--self-test),check-changeset-no-major --base origin/main,check-empty-changeset --base origin/main,check-adr-0087-registration --base origin/main,pnpm --dir ui exec vitest run scripts/. Dogfood: n/a (no!in the title, no(narrowing)arm). Changeset:.changeset/33827-record-page-save-answer.md,@object-ui/app-shellpatch.Generated by Claude Code